﻿Imports ADOConnection

Module myModule
    Public Declare Function GetVolumeInformation Lib "kernel32" Alias "GetVolumeInformationA" ( _
    ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, _
    ByVal nVolumeNameSize As Integer, ByRef lpVolumeSerialNumber As Integer, _
    ByRef lpMaximumComponentLength As Integer, ByRef lpFileSystemFlags As Integer, _
    ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Integer) As Integer

    Private Const BIT1 As Integer = &H1
    Private Const BIT2 As Integer = &H2
    Private Const BIT3 As Integer = &H4
    Private Const BIT4 As Integer = &H8
    Private Const BIT5 As Integer = &H10
    Private Const BIT6 As Integer = &H20
    Private Const BIT7 As Integer = &H40
    Private Const BIT8 As Integer = &H80
    Private Const BIT9 As Integer = &H100
    Private Const BIT10 As Integer = &H200
    Private Const BIT11 As Integer = &H400
    Private Const BIT12 As Integer = &H800
    Private Const BIT13 As Integer = &H1000
    Private Const BIT14 As Integer = &H2000
    Private Const BIT15 As Integer = &H4000
    Private Const BIT16 As Integer = &H8000

    Friend myBits() As Integer = {BIT1, BIT2, BIT3, BIT4, BIT5, BIT6, BIT7, BIT8, BIT9, BIT10, BIT11, BIT12, BIT13, BIT14, BIT15, BIT16}

    Friend myMaxLstCount As Integer = 80

    Friend RegisterOK As Boolean = False
    Friend LoginOK As Boolean = False

    Friend Const myToolInfo As Integer = 3
    Friend Const myToolNewTram As Integer = 2
    Friend Const myToolChonTram As Integer = 4

    Friend Const NHAPNHAYDELAY As Integer = 100

    'Friend myTenDonVi, myComputerName As String
    'Friend myDonVi_ID As Integer
    'Friend myKinhDo, myViDo As Double

    Friend intMonitorW, intMonitorH As Integer
    Friend Const FSIZEMAX As Integer = 72 'font size

    'Friend myLoaiKH_ID As Long = 0
    Friend myBitmap As Bitmap

    Friend myConnStr As String
    'Friend m_DBpropertiesFile As String = System.Environment.CurrentDirectory & "\database_properties.xml"
    Friend g_UserID As String = "sa"
    Friend g_Password As String = "sql2005"
    Friend g_objConnFactory As IConnFactory = Nothing

    Friend fCallForm As Form

    Friend fMainForm As frmMain
    'Friend fCacKyHieu As frmCacKyHieu
    'Friend fVeLinePatern As frmVeLinePatern
    'Friend fCenter As frmCenter
    'Friend fTongHopBC As frmTongHopBC
    'Friend fBCChiTiet As frmBCChiTiet
    'Friend fBCThoiGian As frmBCThoiGian

    'Friend fUpdateSLTram As frmUpdateSLTram
    'Friend fUpdateSLHuong As frmUpdateSLHuong

    'Friend fBanDoNho As frmBanDoNho
    'Friend fSearchDiaDanh As frmSearchDiaDanh

    'Friend fNodesEdit As frmNodesEdit
    'Friend fTramPos As frmTramPos
    'Friend fNewHuong As frmNewHuong

    'Friend Structure MySymbol
    '    Public CX, CY As Integer
    '    Public Patern As MapObjects.CGraphicObjs
    'End Structure

    Friend Structure EDITNODE
        Dim r As Rectangle
        Dim iPart As Integer
        Dim iNode As Integer
    End Structure

    Friend EditNodes() As EDITNODE
    Friend EditNodesCount, iEditNode As Integer

    'Friend myIDControl, myTextControl As Control
    Friend m_LinePatterns As New Hashtable
    Friend m_NodePatterns As New Hashtable

    Friend Function toUnicode(ByVal t1) As String
        Dim KQ As String = ""
        'If IsNull(t1) Then
        Try
            If t1 Is Nothing Then
                t1 = ""
            Else
                t1 = CType(t1, String)
            End If
            Dim aViet() As String = {"Ă", "Â", "Ê", "Ô", "Ơ", "Ư", "Đ", "ă", "â", "ê", "ô", _
          "ơ", "ư", "đ", "*", "*", "*", "*", "*", "*", "à", "ả", "ã", "á", "ạ", _
          "*", "ằ", "ẳ", "ẵ", "ắ", "*", "*", "*", "*", "*", "*", "*", "ặ", "ầ", _
          "ẩ", "ẫ", "ấ", "ậ", "è", "*", "ẻ", "ẽ", "é", "ẹ", "ề", "ể", "ễ", "ế", _
          "ệ", "ì", "ỉ", "*", "*", "*", "ĩ", "í", "ị", "ò", "à", "ỏ", "õ", "ó", "ọ", _
          "ồ", "ổ", "ỗ", "ố", "ộ", "ờ", "ở", "ỡ", "ớ", "ợ", "ù", "*", "ủ", "ũ", _
          "ú", "ụ", "ừ", "ử", "ữ", "ứ", "ự", "ỳ", "ỷ", "ỹ", "ý", "ỵ", "*"}
            Dim t2 As String = ""
            Dim i, j As Integer
            For i = 1 To Len(t1)
                j = Asc(Mid(t1, i, 1)) - 161
                If j < 0 Then
                    t2 = t2 + Mid(t1, i, 1)
                Else
                    If Mid(t1, j, 1) = "*" Then
                        t2 = t2 + Mid(t1, i, 1)
                    Else
                        t2 = t2 + aViet(j)
                    End If
                End If
            Next
            KQ = t2
        Catch
        End Try
        Return KQ
    End Function

    'Sub Main(ByVal CmdArgs() As String)

    '    'Dim f1 As New frmRegister
    '    'RegisterOK = f1.IsRegOK()
    '    'If RegisterOK = False Then
    '    'f1.ShowDialog()
    '    'End If
    '    RegisterOK = True

    '    If RegisterOK = True Then
    '        LoginOK = False
    '        Dim f2 As New frmLogin
    '        f2.ShowDialog()
    '        If LoginOK = True Then
    '            Dim mystr As String = SystemInformation.PrimaryMonitorSize.ToString()
    '            Dim mData() As String
    '            mData = mystr.Split(Chr(61))
    '            intMonitorW = CInt(Val(mData(1)))
    '            intMonitorH = CInt(Val(mData(2)))
    '            Dim f As New frmMain
    '            'If CmdArgs.GetUpperBound(0) > -1 Then
    '            'f.FirstBDTC = CmdArgs(0)
    '            'End If
    '            Try
    '                f.ShowDialog()
    '            Catch ex As Exception
    '            End Try
    '        End If
    '    End If
    '    End
    'End Sub

End Module
